var app = app || {};
app.border = {};
app.border.ballSize = 30;
app.border.ballX = app.border.ballSize / 2;
app.border.ballY = app.border.ballSize / 2;
app.border.vx = 5;
app.border.vy = 5;
app.border.duration = 0.5;
app.border.fps = 24;
app.border.left = 0;
app.border.right = 250;
app.border.top = 0;
app.border.bottom = 200;

(function($) {

	$(function() {
		var ball = $('#ball');
		var border = app.border;
		var move = setInterval(function() {

			border.ballX += border.vx;
			border.ballY += border.vy;

			if ((border.ballX - (border.ballSize / 2)) < border.left) {
				border.ballX = border.left + border.ballSize / 2;
				border.vx *= -1;
			} else if ((border.right - (border.ballSize / 2)) < border.ballX) {
				border.ballX = border.right - (border.ballSize / 2);
				border.vx *= -1;
			}

			if ((border.ballY - (border.ballSize / 2)) < border.top) {
				border.ballY = border.top + border.ballSize / 2;
				border.vy *= -1;
			} else if ((border.bottom - (border.ballSize / 2)) < border.ballY) {
				border.ballY = border.bottom - (border.ballSize / 2);
				border.vy *= -1;
			}

			ball.css('left', (border.ballX - (border.ballSize / 2)));
			ball.css('top', (border.ballY - (border.ballSize / 2)));

		}, (1000 / border.fps));
	});
})(jQuery);